package top.kaoshanji.p4ch28c;

/**
 * 代码清单-p4ch28c-362页a：抽象享元角色
 * @author kaoshanji
 * ^_^
 * create time 2025/3/28 11:20
 */
public abstract class Flyweight {

    // 内部状态
    private String intrinsic;

    // 外部状态
    protected final String extrinsic;

    // 要求享元角色必须接受外部状态
    public Flyweight(String extrinsic) {
        this.extrinsic = extrinsic;
    }

    // 定义业务操作
    public abstract void operate();

    // 内部状态的 get/set
    public String getIntrinsic() {
        return intrinsic;
    }

    public void setIntrinsic(String intrinsic) {
        this.intrinsic = intrinsic;
    }

}
